package com.magic.ch11_7月真题.走方格;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.Queue;

/**
 * created by mzk on 2020/07/16
 */
public class Main_bfs_tle {
    static int n, m;
    static int[][] map;
    static int[] dx = {0, 1};// 右下
    static int[] dy = {1, 0};
    static int ans = 0;


    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        String[] arr = br.readLine().split(" ");
        n = Integer.parseInt(arr[0]);
        m = Integer.parseInt(arr[1]);
        br.close();
        if (n % 2 == 0 && m % 2 == 0) {
            pw.print(ans);
        } else {
            map = new int[n + 5][m + 5];
            PIIs start = new PIIs(1, 1);
            bfs(start);
            pw.print(ans);

        }
        pw.flush();
        pw.close();
    }

    private static void bfs(PIIs start) {
        Queue<PIIs> queue = new LinkedList<>();
        queue.add(start);

        while (!queue.isEmpty()) {
            PIIs tmp = queue.poll();
            for (int i = 0; i < 2; i++) {
                int x = tmp.x + dx[i];
                int y = tmp.y + dy[i];
                if (x % 2 == 0 && y % 2 == 0) {
                    continue;
                }
                if (x > n || y > m) {
                    continue;
                }

                if (x == n && y == m) {
                    // System.out.println(x+"==="+y);
                    ans++;
                }
                queue.add(new PIIs(x, y));

            }
        }
    }
}

class PIIs {
    int x;
    int y;

    public PIIs(int x, int y) {
        this.x = x;
        this.y = y;
    }
}
